package com.febers.ihealth.view

import android.content.Context
import android.util.AttributeSet
import android.widget.RadioButton
import android.widget.RadioGroup

class RadioButtonCanCancel: RadioButton {

    constructor(context: Context): super(context)

    constructor(context: Context, attrs: AttributeSet): super(context, attrs)

    override fun toggle() {
        isChecked = !isChecked
        if (!isChecked) {
            (parent as RadioGroup).clearCheck()
        }
    }

    fun clearCheck() {
        (parent as RadioGroup).clearCheck()
    }
}